﻿@model HdipCricketClub.ViewModels.ScorecardAbandonedFixtureEnterTeamsViewModel
@{
    ViewBag.Title = "EnterAbandonedFixtureTeamDetailsBowledOnly";
}
<h2>
    Enter Abandoned Fixture Team Details Bowled Only</h2>
@using (@Html.BeginForm("EnterScoresBowledOnly", "ScorecardAbandonedFixture", FormMethod.Post))
{
    <fieldset>
        <legend>Fixture</legend>
        <br />
        @Html.HiddenFor(ModelItem => Model.ScorecardFixture.fixture_id)
        @Html.HiddenFor(ModelItem => Model.ScorecardFixture.team_id)
        @Html.HiddenFor(ModelItem => Model.ScorecardFixture.opponent_id)
        @Html.HiddenFor(ModelItem => Model.ScorecardFixture.type)
        @Html.HiddenFor(ModelItem => Model.ScorecardFixture.home)
        @Html.HiddenFor(ModelItem => Model.ScorecardFixture.date)
        @Html.HiddenFor(ModelItem => Model.ScorecardFixture.start_time)
        @Html.HiddenFor(ModelItem => Model.ScorecardFixture.no_of_players)
        @Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.fixture_id)
        @Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.result_id)
        @Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.scorecard_entered)
        @Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.won_toss)
        @Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.batted_first)
        @Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.batted)
        @Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.bowled)
        @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.name)
        vs @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.team_name)
        <br />
        Played on: @Html.DisplayFor(ModelItem => Model.ScorecardFixture.date)
        <br />
        At:
        @if (Model.ScorecardFixture.home)
        {
            @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName)
        }
        else
        {
            @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name)
        }
        <br />
        <br />
        @if (Model.ScorecardHeaderDetail.won_toss)
        {
            @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName)
            @:won the toss
    if (Model.ScorecardHeaderDetail.batted_first)
    {
            @: and elected to bat.
    }
    else
    {
            @: and elected to bowl.
            }
        }
        @if (!Model.ScorecardHeaderDetail.won_toss)
        {
            @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name)
            @:won the toss
    if (Model.ScorecardHeaderDetail.batted_first)
    {
            @: and elected to bowl.
    }
    else
    {
            @: and elected to bat.
            }
        }
    </fieldset>

    <fieldset>
        <legend>@Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name) Team</legend>
        <br />
        <table>
            <tr>
                <th>
                    Batsman No:
                </th>
                <th>
                    Name
                </th>
            </tr>
            @foreach (var item in Model.ScorecardOpponentPlayers)
            {
                <tr>
                    @Html.HiddenFor(modelItem => item.op_fixture_id)
                    @Html.HiddenFor(modelItem => item.op_batsman_number)
                    <td>
                        @Html.DisplayFor(modelItem => item.op_batsman_number)
                    </td>
                    <td>
                        @Html.EditorFor(modelItem => item.op_player_name)
                    </td>
                </tr>
        
            }
        </table>
    </fieldset>
    <fieldset>
        <legend>@Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName) Team</legend>
        <br />
        <br />
        <table>
            <tr>
                <th>
                </th>
                <th>
                    Name
                </th>
                <th>
                    Bowler No:
                </th>
            </tr>
            @{int i = 1;}
            @foreach (var item in Model.ScorecardClubPlayers)
            {
                <tr>
                    @Html.HiddenFor(modelItem => item.fixture_id)
                    @Html.HiddenFor(modelItem => item.player_id)
                    @Html.HiddenFor(modelItem => item.batsman_number)
                    <td>
                        @i
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Member.InitialAndLastName)
                    </td>
                    <td>
                        @Html.EditorFor(modelItem => item.bowler_number)
                    </td>
                </tr>
                i++;
            }
        </table>
    </fieldset>
    <p>
        <input type="submit" value="Submit" />
    </p>
}